# Maintainer: Andrew Chadwick <a.t.chadwick@gmail.com>

_realname=json-c
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.12
pkgrel=2
arch=('any')
pkgdesc="A JSON implementation in C."
url='https://github.com/json-c/json-c'
depends=("")
makedepends=("")
options=('strip' '!debug' 'staticlibs')
license=('MIT')
source=("https://s3.amazonaws.com/json-c_releases/releases/${_realname}-${pkgver}.tar.gz")
sha256sums=('000c01b2b3f82dcb4261751eb71f1b084404fb7d6a282f06074d3c17078b9f3f')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver/_/-}"
}

build() {
  cd "${srcdir}/${_realname}-${pkgver/_/-}"
  # sh autogen.sh  # only for github release tarballs
  CFLAGS="-Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas $CFLAGS"
  export CFLAGS
  ./configure --prefix="${MINGW_PREFIX}"
  make all
}

package() {
  cd "${srcdir}/${_realname}-${pkgver/_/-}"
  make DESTDIR="${pkgdir}" install
  install -D COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
